<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/templates/common/taglib.jsp"%>
<%-- <%@include file="/WEB-INF/templates/common/common.jsp"%> --%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String hospitalVisitJson= (String)request.getAttribute("hospitalVisitJson");
%>
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/html4/strict.dtd"> -->
<!DOCTYPE HTML>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" href="${basePath}/static/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="${basePath}/static/css/list.css"/>
<link rel="stylesheet" href="${basePath}/static/bootstrap/css/bootstrap-combined.min.css"/>
<link rel="stylesheet" href="${basePath}/static/css/print.css"/>
<script type="text/javascript" src="${basePath}/static/jquery/jquery.min.js"></script>
<script type="text/javascript" src="${basePath}/static/bootstrap/js/bootstrap.js"></script>
<script src="${basePath}/static/jqprint/jquery-migrate-1.2.1.min.js"></script>
<script src="${basePath}/static/jqprint/jquery.jqprint-0.3.js"></script>
<script type="text/javascript" src="${basePath}/static/js/print.js"></script>

<style media=print>
 	.noprint{display:none;} 
 	@media print {
 	794px*1123px}
 </style>

</head>
<body>
    <input type="button" onclick="prints()" value="打印" class="printButton"/>
    <input type="hidden" id="firstGuid" value="${firstGuid}">
    <input type="hidden" id="printPageList" value="${printPageList}">
	<div class="print_size" id="print_pdf"> 
			<c:forEach items="${markImgList}" var="markImg">
				<div  style="position:relative;">
					<img  src="${markImg.printImagePath}"/>
				
					 <div style="width:200px;height:200px;overflow:hidden;position:absolute;top:85%;left:40%;z-index:1">
						<img style="opacity:0.2;filter:alpha(opacity=20)" alt="" src="${basePath}/static/images/305logo.jpg"/>
					</div>
					<div class="printcheck" style="position:absolute;top:0;right:0">
						<a class="int" onclick="addPrintStatus(this)">取消</a>
					</div>
				</div>
				<div class="print_split"></div>
			</c:forEach>
			
			
		<%-- 	<c:forEach var="printPage" items="${printPageList}">
		   	<c:if test="${printPage==29}">
			<div id="reportsRecords"></div>
		    <div hidden="true" id="reportsRecordTemplate">
		    	<div class="print_split"></div>
				<div class="print_page">
					<br/>
				    <h4  align="center">中国人民解放军第三〇五医院检验报告单</h4>
					<table style="width: 754px;" class="print_table" id="reportsRecordTableTemplate">
						<tbody id="reportsRecordsTbody">
							<tr>
								<td style='width: 754px;border: none;padding-left: 15px;'colspan="4">
									<label style='width: 240px;float:left;'>姓&nbsp;名:<span class="patientName"></span></label>
									<label style='width: 240px;float:left;'>性&nbsp;别:<span class="sexName"></span></label>
									<label style='width: 240px;float:left;'>年&nbsp;龄:<span class="ageName"></span></label>
									<label style='width: 240px;float:left;'>病&nbsp;案:<span class="mrId"></span></label>
								
									<label style='width: 240px;float:left;'>科&nbsp;别:<span class="deptCategoryName"></span></label>
									<label style='width: 240px;float:left;'>床&nbsp;位:<span class="bedName"></span></label>
									<label style='width: 240px;float:left;'>费&nbsp;别:<span class="costName"></span></label>
									<label style='width: 240px;float:left;'>送检医师:<span class="submittingPhysicianName"></span></label>
								
									<label style='width: 240px;float:left;'>样本编号<span class="specimenCode"></span></label>
									<label style='width: 240px;float:left;'>条码编号:<span class="barCode"></span></label>
									<label style='width: 240px;float:left;'>标本种类:<span class="specimenTypeName"></span></label>
									<label style='width: 240px;float:left;'>临床诊断:<span class="clinicalDiagnosisName"></span></label>
								</td>
							</tr>
							<tr >
								<td id="double_title" hidden='true' style="width: 754px;border-left: none;border-right:none;padding-left: 15px;" colspan="4">
									<label style="width: 130px;font-weight:600;">项目名称</label>
									<label style="width: 80px;font-weight:600;">结果</label>
									<label style="width: 60px;font-weight:600;">单位</label>
									<label style="width: 70px;font-weight:600;">参考值</label>
									<label style="width: 130px;font-weight:600;">项目名称</label>
									<label style="width: 80px;font-weight:600;">结果</label>
									<label style="width: 60px;font-weight:600;">单位</label>
									<label style="width: 70px;font-weight:600;">参考值</label>
								</td>
								<td id="single_title" hidden='true' style="width: 754px;border-left: none;border-right:none;padding-left: 15px;" colspan="4">
									<label style="width: 260px;font-weight:600;">项目名称</label>
									<label style="width: 170px;font-weight:600;">结果</label>
									<label style="width: 130px;font-weight:600;">单位</label>
									<label style="width: 140px;font-weight:600;">参考值</label>
								</td>
							</tr>
							<tr id="reportItemTrTemplate" hidden="true"> 
								<td style="width: 754px;border:none;" colspan="4">
									<label style="width: 15px;"><span class="index"></span></label>
									<label style="width: 244px;"><span class="projectName"></span></label>
									<label style="width: 64px;"><span class="examinationResult"></span></label>
	                                <label style="width: 104px;"><span class="examinationResultMark"></span></label>
									<label style="width: 130px;"><span class="examinationUnit"></span></label>
									<label style="width: 140px;"><span class="referenceValues"></span></label>
								</td>
							</tr>
							<tr id="double_reportItemTrTemplate" hidden="true"> 
								<td style="width:50%;border:none;">
								   
									<label style="width: 122px;"><span class="projectName"></span></label>
									<label style="width: 32px;"><span class="examinationResult"></span></label>
	                                <label style="width: 52px;"><span class="examinationResultMark"></span></label>
									<label style="width: 65px;"><span class="examinationUnit"></span></label>
									<label style="width: 70px;"><span class="referenceValues"></span></label>
								</td>
								<td style="width:50%;border:none;">
									<label style="width: 122px;"><span class="projectName_"></span></label>
									<label style="width: 32px;"><span class="examinationResult_"></span></label>
	                                <label style="width: 52px;"><span class="examinationResultMark_"></span></label>
									<label style="width: 65px;"><span class="examinationUnit_"></span></label>
									<label style="width: 70px;"><span class="referenceValues_"></span></label>
								</td>
							</tr> 
						   <!--  <tr> 
								<td style="border:none;" colspan="4">
									<label></label>
									<label></label>
									<label></label>
									<label></label>
									<label></label>
									<label></label>
								</td>
							</tr> -->
						</tbody>
							<!-- <tr> 
								<td style="border:none;" colspan="4">
									<label></label>
									<label></label>
									<label></label>
									<label></label>
									<label></label>
									<label></label>
								</td>
							</tr> -->
							<tr style="border-top: 1px #000 solid;">
								<td style="width: 754px;border:none;" colspan="4">
									<label style="width: 254px;">采样时间:<span class="samplingDateTime"></span></label>
									<label style="width: 254px;">送检时间:<span class="inspectDateTime"></span></label>
									<label style="width: 180px;">检验者:<span class="inspectionDoctorName"></span></label>
								</td>
							</tr>
							<tr>
								<td style="border:none;" colspan="4">
									<label style="width: 254px;">核收时间:<span class="acceptanceCheckDateTime"></span></label>
									<label style="width: 254px;">报告时间:<span class="reportDateTime"></span></label>
									<label style="width: 180px;">审核者:<span class="auditorDoctorName"></span></label>
								</td>
							</tr>
							<tr>
								<td style="border:none;" colspan="4">
									<label style="width: 594px;">备注:<span class="remark"></span></label>
								</td>
							</tr>
					</table>
				    <div style="width:200px;height:200px;overflow:hidden;position:absolute;top:40%;left:40%;z-index:1">
							<img style="opacity:0.2;filter:alpha(opacity=20)" alt="" src="${basePath}/static/images/305logo.jpg"/>
					</div>
				</div>
			
			 
			</div>
			</c:if>
			</c:forEach> --%>
		
	</div>
</body>
<style media=print type="text/css"> 
  .printButton{visibility:hidden} 
</style>
<script>


	function addPrintStatus(obj){
		var $this = $(obj);
		var $parentli = $this.parent("div").parent("div");
		var checkStatus = $this.is(':checked');
			$parentli.next().remove();
			$parentli.remove();
		
	}

	function prints(){
		$(".printcheck").css("display","none");
	/* 	$(".noprint").css("display","none"); */
		$("#print_pdf").jqprint();
	}
	$(function(){
		var hospitalVisitJson= <%=hospitalVisitJson%>;
		//console.log(hospitalVisitJson);
		var hospitalVisitJson = eval('(' + hospitalVisitJson + ')');
		if(JSON.stringify(hospitalVisitJson)=="{}"){
		      //$("#print_pdf").html("");
	    }else{
		//var hospitalVisit=hospitalVisitJson.basicInfo;
		//住院期间治疗情况 护理 及褥疮  
		//var cureInfo=hospitalVisitJson.cureInfo;
		//var intensiveCareInfo=hospitalVisitJson.intensiveCareInfo;
		//var nurseInfo=hospitalVisitJson.nurseInfo;
		//var pressureSoreInfo=hospitalVisitJson.pressureSoreInfo;
		//病案首页基本信息
		//basicdata(hospitalVisit);
		
		//console.log(hospitalVisit);
		//病案首页疾病诊断
		//diseaseDiagRecords(hospitalVisitJson.diseaseDiagInfo);
		//console.log(hospitalVisitJson.diseaseDiagInfo);
		//病案首页手术操作
		//operateInfo(hospitalVisitJson.operateInfo.operateRecords);
		//诊断符合情况
		//diagAccordRecords(cureInfo);
		//personnelCategory(hospitalVisit);
		//住院期间
		//inhospitalInfo(cureInfo,nurseInfo,intensiveCareInfo,pressureSoreInfo);
		//输血品种
		//infusionBloodInfo(hospitalVisitJson.infusionBloodInfo);
		//住院费用
		//costRecords(hospitalVisitJson.visitCostInfo);
		//医护工作者
		//cureWorkers(cureInfo);
		//alert(JSON.stringify(cureInfo));
		//临时医嘱 
		//doctorAdviceTemporaryInfo(hospitalVisitJson.doctorAdviceTemporaryInfo);
		//console.log(hospitalVisitJson.examinationReportsInfo)
		addReportsRecord(hospitalVisitJson.examinationReportsInfo);
		//长期医嘱单
		//doctorAdviceStandingInfo(hospitalVisitJson.doctorAdviceStandingInfo);
	    }
		
	/* 	var printPageList =$("#printPageList").val();
		if(printPageList){
			var printTypeArr=printPageList.split(",");
			if(isInArray(printTypeArr,"6")){
				//病程记录单
				var guid=$("#firstGuid").val();
				initProgressNote(guid);
				var imgHtml='<div style="width:200px;height:200px;overflow:hidden;position:absolute;top:40%;left:40%;z-index:1">'+
				    '<img style="opacity:0.2;filter:alpha(opacity=20)" alt="" src="${basePath}/static/images/305logo.jpg">'+
				    '</div>';
			}
		}
		
		
		function initProgressNote(guid) {
			var url = "${corePath}/medical_record/getProgressNote";
			var dataform = {"visitGuid":guid};
            $.ajax({
			    type:"get",
			    url:url,
			    dataType:"json",
			    data:dataform,
			    success:function(result){
			         if(result.success){
			        	  var data = result.data;
			              if (data != null && data.length > 0) {
			            	  var content = "";
			            	   $.each(data, function(index, htmlStr) {
			            		   content+='<div class="print_split"></div><br/>'+"<div class='print_page'>"+htmlStr+imgHtml+"</div>";
			            		});
			            	  
			            	 $("#print_pdf").append(content);
			               }
			         }
			    },
			    error:function(XMLHttpRequest, textStatus, errorThrown) {
			        	//console.log(textStatus+"-"+errorThrown)
			          if(XMLHttpRequest.status == 403) {
			                 alert("没有权限!");
			          }
			   }  //error end 
			   
			}); //ajax 结束	
			
		} */
	});
	

	function isInArray(arr,value){
	    for(var i = 0; i < arr.length; i++){
	        if(value === arr[i]){
	            return true;
	        }
	    }
	    return false;
	}

</script>
</html>
